#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argv, char *argc[])
{
  printf("argv=%d\n",argv);
  
  if (argv!=2) {
    printf("usage: metermonctrl start|stop\n\n");
    return(-1);
  }
  
  if (!strcmp(argc[1],"stop")) {
    setuid( 0 );
    system( "/etc/init.d/metermon stop" );
    return 0;
  }
  if (!strcmp(argc[1],"start")) {
    setuid( 0 );
    system( "/etc/init.d/metermon start" );
    return 0;
  }
  
  printf("Unrecognised parameter %s\n\n",argc[1]);
  return 0;
}

         
